<template>
  <n-tag :bordered="false" :type="data?.color ?? ''" :size="size" v-if="data">
    {{ data?.label ?? '' }}
  </n-tag>
  <span v-else></span>
</template>

<script setup lang="ts">
  import { getAsyncEnums } from '@/enums/dataEnum';
  import { ref, PropType } from 'vue';

  const props = defineProps({
    code: {
      type: String,
      default: '',
    },
    tagKey: {
      type: [String, Number],
      default: '',
    },
    size: {
      type: String as PropType<'small' | 'medium' | 'large'>,
      default: 'medium',
    },
  });
  const temp = getAsyncEnums(props.code);
  const data = ref(temp['map'][props.tagKey]);
</script>

<style scoped lang="less"></style>
